require 'uri'

module Textp
  class Parser

    # Pass in some text and all things that
    # can be parsed will be parsed and seperated into
    # individual parts.
    # 
    # Usage:
    # => Parser.new("Meeting tomorrow at 3:30 PM.")
    # => Parser.new("This embeded video is cool: youtube_link")

    def initialize(text)
      @text = text
    end

    def parse
      (!@text.nil?) ? @text : nil
    end

    def has_links?
      urls = URI.extract(@text)
      (urls.empty?) ? false : true
    end

    def links
      links = URI.extract(@text)
      links
    end

  end
end